<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title th:if="${shaketicket.actName ne null}">[[${shaketicket.actName}]]</title>
	<meta charset="UTF-8">
	<meta content="yes" name="apple-mobile-web-app-capable"></meta>
	<meta content="black" name="apple-mobile-web-app-status-bar-style"></meta>
	<meta name="format-detection" content="telephone=no"></meta>
	<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"></meta>
	<meta content="yes" name="full-screen"></meta>
	<meta content="true" name="x5-fullscreen"></meta>
	<meta content="application" name="browsermode"></meta>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
	<link th:href="@{/content/shaketicket/default/css/shake.css}" type="text/css" rel="stylesheet" />
	<link th:href="@{/content/shaketicket/default/css/site.css}" type="text/css" rel="stylesheet" />
	<link th:href="@{/content/shaketicket/default/css/style.css}" type="text/css" rel="stylesheet" />
	<link th:href="@{/content/shaketicket/default/css/common-site.r4409.css}" type="text/css" rel="stylesheet" />
	<script th:src="@{/content/shaketicket/default/js/jquery-1.10.2.min.js}" type="text/javascript"></script>
	<script th:src="@{/content/shaketicket/default/js/common-site.r4443.js}" type="text/javascript"></script>
	<script th:src="@{/content/shaketicket/default/js/shake.js}" type="text/javascript"></script>
	<script th:src="@{/content/shaketicket/default/js/common.js}" type="text/javascript"></script>
	<script th:src="@{/content/shaketicket/default/js/jQueryRotate.js}" type="text/javascript"></script>
	<script th:src="@{/content/shaketicket/default/js/wxcheck.js}" type="text/javascript"></script>
	<style type="text/css">
	  .logo{width:30px;height:30px;border-radius:100px;}
	</style>
	
</head>
<body style="background-color:red;">
<div th:if="${act_Status eq false}">
   <p th:text="${act_Status_Msg}"></p>
</div>

<!--摇一摇首页-->
<div class="content-wrap">
<div>欢迎光临！！<img  class="logo" th:src="${weixinDto.headimgurl}"> [[${weixinDto.nickname}]]</div>  
	<!-- <div class="light hide"><div class="ss"></div></div> -->
	<div class="shake-box">
		<div class="title">摇一摇</div>
		<div class="hand"><img alt="摇一摇" th:src="@{/content/shaketicket/default/img/hand.png}"></div>
		<div class="inner"></div>
	</div>
        <div  th:if="${shaketicket.count ne 0}" class="join-man" id="hdcountStr" style="position:fixed;top:80%;margin:0;width:100%;text-align:center"><div style="display:inline-block">本次活动每人可抽[[${shaketicket.count}]]次，您还有<span id="num">[[${shaketicket.count- count}]]</span>次机会</div> <div class="join-man" id="hdcountStr"></div></div>

		<div th:if="${perday ne 0}" class="join-man" id="hdcountStr" style="position:fixed;top:83%;width:100%;margin:0;text-align:center"><div style="display:inline-block">每天可抽[[${shaketicket.numPerDay}]]次，您今天还有<span id="count">[[${shaketicket.numPerDay - countday}]]</span>次机会</div></div>
        <div class="text" th:if="${perday eq 0}">本次活动不限制每天可抽次数</div>
	 <div class="gift-rule">
		<a class="btn" id="rule-btn"><i class="fa fa-file-text-o" style="font-size:12px;"></i> 活动规则</a>
		&nbsp;&nbsp;
		<a class="btn" href="#jptitle"><i class="fa fa-gift"></i>我的奖品</a>
	</div>
	<div class="copyright" style="background:none;text-align:center;color:#f9dc97;font-size:14px;top:83%">免费创建一个活动<a href="http://mp.weixin.qq.com/s?__biz=MzI0MzA3MjI3MA==&mid=2656414114&idx=1&sn=962977778fd377b20c5e69c821ad29d5&chksm=f2d3a5c3c5a42cd5a1255fb4858a0749a24d339d3ad17c9d075026b607699ecaea5661dca16f#rd" style="font-size:14px;color:#f9dc97;font-weight:bold"></a></div>
</div>
<!-- [[${huodong_bottom_copyright}]] -->
<!--摇一摇首页-->
<div class="top_bar" style="-webkit-transform:translate3d(0,0,0)">
  <nav>
    <ul id="top_menu" class="top_menu">
	    <li>
	      <a href="$!{basePath}/shaketicket/toDetail.do?actId=$!{weixinDto.actId}&appid=$!{weixinDto.appid}&jwid=$!{weixinDto.jwid}&openid=$!{weixinDto.openid}&subscribe=$!{weixinDto.subscribe}"><img th:src="@{/content/shaketicket/default/img/plugmenu9.png}"><label>活动规则</label></a>
	    </li>  
		<li class="home">
		  <a href="javascript:void(0)" style="background: url('/content/shaketicket/default/img/home.png') no-repeat center center;opacity:0.75;"></a>
		</li>
	    <li>
	      <a href="$!{basePath}/shaketicket/toMyAwardsRecordList.do?actId=$!{weixinDto.actId}&appid=$!{weixinDto.appid}&jwid=$!{weixinDto.jwid}&openid=$!{weixinDto.openid}&subscribe=$!{weixinDto.subscribe}"><img th:src="@{/content/shaketicket/default/img/plugmenu11.png}"><label>我的奖品</label></a>
	    </li>   
    </ul>
  </nav>
</div>
<!--摇一摇活动说明-->
<div id="rule" class="hide"><div style="text-align:left">活动说明：<br><br>[[${shaketicket.detail}]]</div></div>
<!--摇一摇活动说明-->
<!--摇一摇没有绑定手机提示-->
<!-- <div id="no_binding_phone" class="hide"><div style="text-align:left">没有绑定手机号：<br><br>$!{dictTool.getSysText('index.tip.nobindingphone',$!{shaketicket.id})}</div></div> -->
<!--摇一摇没有绑定手机提示-->
<!--原摇一摇未关注提示beigin-->
<!-- <div id="" class="hide"><div style="text-align:left">没有关注：<br><br>$!{dictTool.getSysText('index.tip.nofocus',$!{shaketicket.id})}</div></div> -->
<!--原摇一摇未关注提示end-->
<!--新摇一摇未关注提示beigin-->
<div style="opacity: 1;display:none" class="bombScreen" id="no_focus">
   <div style="width:70%;margin: 0 auto;margin-top:30%;">
       <p style="text-align:center;color:#fff;font-size:1.4rem;padding-top:2%">关注下面公共号才能参与活动</p>
       <div style="width:90%;margin: 0 auto;auto;margin-top:4%">
         <!--  <img src="$!{basePath}$!{qrcodeUrl}" style="width:100%;"/>
    	  <p style="text-align:center;color:#fff;font-size:1.4rem;padding-bottom:2%;margin:0">长按识别二维码关注</p>
		  <p style="text-align:center;color:#fff;font-size:1.4rem;">$!{dictTool.getSysText('focus_explain',$!{weixinDto.actId})}</p> -->
      </div>
  </div>
</div>
<!--新摇一摇未关注提示end-->
<!--摇一摇音效-->
<audio id="audio_shake" th:src="@{/content/shaketicket/default/vedio/wechat_shake.mp3}" preload></audio>
<!--摇一摇音效-->

<img th:src="@{/content/shaketicket/default/img/index.gif}" style="height:0;width:0;display:none;" border="0">
<!--摇一摇背景图-->
<input type="hidden" th:value="@{/content/shaketicket/default/img/picurl-shake.jpg}" id="share_img_url">
<!--摇一摇背景图-->
	<!--  	<input type="hidden" name="jwid" id="jwid" value="$!{weixinDto.jwid}"/>
		<input type="hidden" name="openid" id="openid" value="$!{weixinDto.openid}"/>
	    <input type="hidden" name="subscribe" id="subscribe" value="$!{weixinDto.subscribe}"/>
	    <input type="hidden" name="appid" id="appid" value="$!{weixinDto.appid}"/>
	    <input type="hidden" name="actId" id="actId" value="$!{weixinDto.actId}"/>
	    <input type="hidden"  id="timestamp" value="$!{timestamp}"/>
	    <input type="hidden"  id="nonceStr" value="$!{nonceStr}"/>
	    <input type="hidden"  id="signature" value="$!{signature}"/> -->
	    
	     <input type="hidden" name="actId" id="actId" th:value="${weixinDto.actId}"/>
		<input type="hidden" name="openid" id="openid" th:value="${weixinDto.openid}"/>
		<input type="hidden" name="nickname" id="nickname" th:value="${weixinDto.nickname}"/>
		<input type="hidden" name="jwid" id="jwid" th:value="${weixinDto.jwid}"/>
		<input type="hidden" name="appid" id="appid" th:value="${weixinDto.appid}"/>
	    
	    
<!-- 活动运行状态  start-->
<div th:if="${act_Status == false}" style="opacity: 1;width: 100%;height: 100%;position: fixed;z-index: 1000;top: 0px;left: 0px;background: rgba(0, 0, 0, 0.8) none repeat scroll 0% 0%;">
    <div style="width:100%;height:100%;display: flex;align-items: center;justify-content: center;font-size: 2rem;color: #fff;">[[${act_Status_Msg}]]</div> 	
</div>
<!-- 活动运行状态  end-->
</body>
<script th:inline="javascript"> 
    var ctx = [[@{/}]];
	$().ready(function() {
		var content = [[${shaketicket.detail}]];
		$("#rule").html(content);
	});
</script>
<script th:inline="none">
$(document).ready(function(){
	
	setInterval(yaoyiyao, 6000);
    

	

});

function yaoyiyao(){
	var vargs = [[-21,100], [0,300], [-21,600], [0,850]];
	$(vargs).each(function(){
		 var _this = this;
		 setTimeout(function(){ $('.shake-box .hand').rotate(_this[0]); }, _this[1]);
    }); 
}


$(function(){
	$(".copyright").css("bottom","-5.2rem");
	$(".copyright").css("height","");
	$(".copyright").css("line-height","0.8rem");

})
</script>
<!-- 微信分享功能 -->
<script th:inline="javascript">
document.body.addEventListener('touchmove', function (event) {
    event.preventDefault();
}, false);

	wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: [[${weixinDto.appid}]], // 必填，公众号的唯一标识
        timestamp: [[${timestamp}]], // 必填，生成签名的时间戳
        nonceStr: [[${nonceStr}]], // 必填，生成签名的随机串
        signature: [[${signature}]],// 必填，签名，见附录1【必填：通过提供接口获取】
        jsApiList: [
    	        'checkJsApi',
    	        'onMenuShareTimeline',
    	        'onMenuShareAppMessage'
    	        ]
         // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
       });
    wx.ready(function () {
    	var newHdUrl = [[${hdUrl}]];
		//微信朋友圈
 	    wx.onMenuShareTimeline({
            title: [[${shaketicket.actName}]], // 分享标题【必填】
            link: newHdUrl, // 分享链接【必填】
            imgUrl: [[${shaketicket.shortUrl}]], // 分享图标【必填】
            success: function () { 
                // 用户确认分享后执行的回调函数
                alert('分享成功');
                var count_times = $("#count").html();
                count_times++;
                $("#count").html(count_times);
            },
            cancel: function () { 
                // 用户取消分享后执行的回调函数
                
            }
        });
        
	    //微信好友
        wx.onMenuShareAppMessage({
            title: [[${shaketicket.actName}]], // 分享标题【必填】
            desc: [[${shaketicket.template}]], // 分享描述【必填】
            link: newHdUrl, // 分享链接【必填】
            imgUrl: [[${shaketicket.shortUrl}]], // 分享图标【必填】
            type: 'link', // 分享类型,music、video或link，不填默认为link【必填】
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () { 
                // 用户确认分享后执行的回调函数
				alert('已分享,增加一次抽奖机会');
            },
            cancel: function () { 
                // 用户取消分享后执行的回调函数
				 alert('已取消');
            }
        });

  	});
	
	function addCard(id){
		var openid='$!{weixinDto.openid}';
		var actId='$!{weixinDto.actId}';
		var jwid='$!{weixinDto.jwid}';
		var url = "$!{basePath}/shaketicket/getMyAwards.do";
			jQuery.getJSON(url, {id:id,"actId": actId,"openid" : openid,"jwid" : jwid}, function(data,status,xhr){
				if(data.success){
					var cardId=data.obj.card_id;
					var recordId=data.obj.record_id;
					var openid = data.obj.openid;
					var timestamp = data.obj.timestamp;
					var nonce_str = data.obj.nonce_str;
					var signature = data.obj.signature;
					//alert("cardId:"+cardId+";openid:"+openid+";timestamp:"+timestamp+";nonce_str:"+nonce_str+";signature:"+signature);
					wx.addCard({
					    cardList: [{
					        cardId:cardId,
					        cardExt: '{"code":"","openid":"'+openid+'","nonce_str":"'+nonce_str+'", "timestamp": '+timestamp+', "signature":"'+signature+'"}'
					    }], // 需要添加的卡券列表
					    success: function (res) {
					        var cardList = res.cardList; // 添加的卡券列表信息
					        addCardCallback(recordId);
					    },
					    cancel:function (res) {
					        close();
					    }
					});
				}else{
					alert("还没有获得奖品");
				}
			});
		
	    }


	function addCardCallback(recordId){
		var url = "$!{basePath}/shaketicket/addCardCallback.do";
		jQuery.getJSON(url,{"id": recordId},function(data){
		      	close();
		});
	}
	
	function close(){
		if (typeof WeixinJSBridge == "undefined"){
		    if( document.addEventListener ){
		        document.addEventListener('WeixinJSBridgeReady', closeWindow, false);
		    }else if (document.attachEvent){
		        document.attachEvent('WeixinJSBridgeReady', closeWindow); 
		        document.attachEvent('onWeixinJSBridgeReady', closeWindow);
		    }
		}else{
			WeixinJSBridge.call('closeWindow');
		}
	}
</script>
<!-- <script type="text/javascript">
$!{dictTool.getSysText('statistics',$!{shaketicket.id})}
</script> -->
</html>